#include<iostream>
#include <string>
#include<cstdio>
#include <memory>
#include "Httpserver.hpp"

using std::cin;
using std::cout;
using std::endl;

void menu(char* str)
{
    cout<<"menu:\n\r";
    cout<<str<<" "<<"port"<<endl;
}

//http://47.122.114.21:8080/

int main(int argc,char* argv[])
{

    if(argc !=2)
    {
        LOG(FATAL,"Format error");
        // cout<<""<<endl;
        menu(argv[0]);
        exit(4);
    }
    // printf("5\n");
    int port=atoi(argv[1]);
    // static Tcpserver* server=Tcpserver::Getinstance(port);
    //下面两种方法都可以创建一个智能指针。不能使用赋值符号！！！

    std::shared_ptr<Httpserver> Http_svr(new Httpserver(port));
    // auto Http_svr=std::make_shared<Httpserver>(port);
    Http_svr->Init_Server();
    Http_svr->Loop();

    //cout<<"hello world"<<endl;
    // auto Test=Tcpserver::Getinstance(port);
    // Test->Init();

    return 0;
}
